package com.action;

import com.pojo.Rewind;
import com.service.RewindService;
import com.vo.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@CrossOrigin("*")
@RequestMapping("/rewind")
public class RewindAction {

    @Autowired
    private RewindService rewindService;

    /**
     *  储存交卷信息
     * @param rewind  提交答案
     * @return
     */
    @RequestMapping("/addRewind")
    public ResponseBean addRewind(Rewind rewind){
        // 添加考生的答题试卷
        int n=rewindService.addRewind(rewind);
        // n>0 添加成功   否则  添加失败
        return new ResponseBean(0,0,n);
    }

    /**
     *  根据 考生交卷id 查询 考卷内容
     * @param rewindId   考生交卷id
     * @return
     */
    @RequestMapping("/findByIdRewind")
    public ResponseBean findByIdRewind(Integer rewindId){
        // 考生交卷内容
        Map map=rewindService.findByIdRewind(rewindId);
        return new ResponseBean(0,0,map);
    }

}
